require(["ditto", "ui", "scroll"], function(ditto, ui, scroll){
    var CONFIG = {
        document_title: "ECMAScript 6入门",
        index: "README.md",
    
        sidebar_file: "sidebar.md",

        base_url: "https://github.com/ruanyf/es6tutorial/edit/gh-pages",

        scroll: function ()
        {
            scroll("#sidebar").window.left = 10;
        }
    };
    
    addConfig(ditto, CONFIG);
    
    function addConfig(obj, conf) {
        Object.keys(conf).forEach(function (key) {
            obj[key] = conf[key];
        });
    }
    
    ditto.run();

    var menu = ui.addNode(document.body, "div", "innerFirst", {
        style: {
            height: "100%",
            width: 5,
            position: "fixed"
        }
    });

    ui.hander.add(menu, "mouseover", function(){
        sidebar.style.left = 0;
    });

    ui.hander.add(content, "mouseover", function(){
        sidebar.style.left = "-320px";
    });

});